﻿@using Smartstore.Web.Models.Catalog

@model BrandModel

@{
    Assets.AppendTitleParts(Model.MetaTitle.HasValue() ? Model.MetaTitle : Model.Name);
    Assets.AppendMetaDescriptionParts(Model.MetaDescription);
    Assets.AppendMetaKeywordsParts(Model.MetaKeywords);

    if (Model.CanonicalUrl.HasValue())
    {
        Assets.AppendCanonicalUrlParts(Model.CanonicalUrl);
    }

    ViewBag.HideLeftCol = true; // ...on mobile
}

<partial name="MetaProperties" model="Model.MetaProperties" />

<widget target-zone="left">
    <partial name="Search.Filters" model="Model.Products" />
</widget>

<div class="page manufacturer-page">
    <div class="page-title">
        <h1 sm-language-attributes-for="Model.Name" class="h3">
            @Html.Raw(Model.Name)
        </h1>
        @if (Model.SearchResult.TotalHitsCount > 0)
        {
            <partial name="SearchResultHitsCount" model="Model.SearchResult" />
        }
    </div>

    <div class="page-body">
        <zone name="manufacturerdetails_top" />

        @* Description *@
        @if (Model.Description.HasValue())
        {
            <div sm-language-attributes-for="Model.Description" class="manufacturer-description lead html-editor-content">
                <collapsed-content>
                    @Html.Raw(Model.Description)
                </collapsed-content>
            </div>
        }

        @* Featured products *@
        @if (Model.FeaturedProducts != null && Model.FeaturedProducts.Items.Count > 0)
        {
            <zone name="manufacturerdetails_before_featured_products" />

            <div class="product-grid featured-product-grid block">
                <div class="heading heading-center">
                    <h3 class="heading-title fs-h1">@T("Products.FeaturedProducts")</h3>
                </div>
                <div class="block-body pt-3 artlist-no-separators">
                    <partial name="Product.List" model="Model.FeaturedProducts" />
                </div>
            </div>
        }

        @* Product list *@
        <zone name="categorydetails_before_product_list" />

        <div class="product-list-container">
            @if (Model.Products != null)
            {
                <partial name="Product.List" model="Model.Products" />
            }
        </div>

        @if (Model.BottomDescription.Value.HasValue())
        {
            <div sm-language-attributes-for="Model.BottomDescription" class="manufacturer-description lead html-editor-content">
                <collapsed-content>
                    @Html.Raw(Model.BottomDescription)
                </collapsed-content>
            </div>
        }

        @* TODO: (mc) find more intelligent way of rendering RecentlyViewedProducts globally *@
        @await Component.InvokeAsync("RecentlyViewedProducts")
        <zone name="manufacturerdetails_bottom" />
    </div>
</div>